import { NestFactory } from '@nestjs/core';
import { AppModule } from './app.module';
import { ValidationPipe } from '@nestjs/common';
import initSwagger from './common/swagger';
import { LoggerMiddleware } from './middleware/logger.middle';
import { RequestCountMiddleware } from './middleware/requestCount.middle';
import config from 'src/config/config';
import * as dotenv from 'dotenv'
import axios from 'axios';
async function bootstrap() {
   
 
  const app = await NestFactory.create(AppModule,{
  });
  app.use(new LoggerMiddleware().use)
 
  
  app.use(new RequestCountMiddleware().use)
  app.useGlobalPipes(new ValidationPipe({
    enableDebugMessages:true,
    stopAtFirstError:true,
  }));
  initSwagger(app)
  await app.listen(config.SERVICE_PORT);
}
bootstrap();
